﻿<UserControl x:Class="Sonce.Database.DataViewer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    Margin="5">
  <Grid x:Name="LayoutRoot">
    <Grid.RowDefinitions>
      <RowDefinition Height="22" />
      <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    
    <!-- Upper panel -->
    <StackPanel Grid.Row="0" Orientation="Horizontal">
      <Button x:Name="btnRefresh" Content="Refresh" Width="65" VerticalAlignment="Center" Click="btnRefresh_Click" />
      
      <TextBlock Text="Table:" Margin="20,0,5,0" VerticalAlignment="Center" />
      <ComboBox x:Name="cmbTables" Width="200" SelectionChanged="cmbTables_SelectionChanged" VerticalAlignment="Center" />
      
      <TextBlock Text="Items per page:" Margin="20,0,5,0" VerticalAlignment="Center" />
      <ComboBox x:Name="cmbPageSize" Width="70" VerticalAlignment="Center" SelectedIndex="0" SelectionChanged="cmbPageSize_SelectionChanged">
        <ComboBoxItem Content="25" />
        <ComboBoxItem Content="50" />
        <ComboBoxItem Content="100" />
      </ComboBox>

      <TextBlock Text="Page number:" Margin="20,0,5,0" VerticalAlignment="Center" />
      <ComboBox x:Name="cmbPageNum" Width="70" VerticalAlignment="Center" SelectionChanged="cmbPageNum_SelectionChanged" />
      
      <TextBlock Text="Total items:" Margin="20,0,5,0" VerticalAlignment="Center" />
      <TextBlock x:Name="lblTotal" Text="10" VerticalAlignment="Center" />
      
      <!--ComboBox x:Name="cmbTables" Width="200">
        <ComboBox.ItemTemplate>
          <DataTemplate>
            <ComboBoxItem Content="{Binding Name}" />
          </DataTemplate>
        </ComboBox.ItemTemplate>
      </ComboBox-->
    </StackPanel>

    <!-- Bottom panel -->
    <data:DataGrid x:Name="dgViewer" Grid.Row="1" Margin="0,5,0,0" AutoGenerateColumns="True" 
      HeadersVisibility="All" RowBackground="Cornsilk" AlternatingRowBackground="LemonChiffon"
      ColumnWidth="85" RowHeight="30" IsReadOnly="True" CanUserResizeColumns="True">
    </data:DataGrid>
  </Grid>
</UserControl>
